#include <stdio.h>

int main() {
    int n, k;
    scanf("%d", &n);
    scanf("%d", &k);

    int A[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &A[i]);
    }

    int maxSum = 0;
    int currentSum = 0;
    for (int i = 0; i < k+1; i++) {
        currentSum += A[i];
    }
    maxSum = currentSum;

    for (int i = k+1; i < n; i++) {
        currentSum = currentSum - A[i - k-1] + A[i];
        if (currentSum > maxSum) {
            maxSum = currentSum;
        }
    }

    printf("%d\n", maxSum);

    return 0;
}
